Skip to main content

Getting Started with GitHub

This guide will walk you through setting up GitHub from scratch, creating your first repository, and understanding the basic workflow. Whether you're completely new to version control or just new to GitHub, this tutorial will get you up and running quickly.

Prerequisites

Before we begin, you'll need:

  • A computer with internet access
  • Basic familiarity with using a terminal/command prompt (helpful but not required)
  • A text editor or IDE installed on your computer

Step 1: Create Your GitHub Account

  1. Navigate to github.com
  2. Click the "Sign up" button in the top right corner
  3. Enter your email address, create a strong password, and choose a username
  4. Complete the verification process (solve the puzzle)
  5. Choose your preferences for GitHub updates and notifications
  6. Verify your email address by clicking the link sent to your inbox

Step 2: Install Git

Git is the version control system that powers GitHub. You'll need it installed on your computer to work with repositories locally.

  1. Download Git from git-scm.com
  2. Run the installer with default settings (recommended for beginners)
  3. Open Command Prompt or PowerShell and verify installation:
git --version

Step 3: Configure Git

After installing Git, configure it with your GitHub credentials:

# Set your name (use your real name)
git config --global user.name "Your Name"

# Set your email (use the same email as your GitHub account)
git config --global user.email "[email protected]"

# Set default branch name to 'main'
git config --global init.defaultBranch main

# Verify your configuration
git config --list

Step 4: Create Your First Repository

  1. Click the "+" icon in the top right corner of GitHub
  2. Select "New repository"
  3. Fill in the repository details:
    • Repository name: Choose a descriptive name (e.g., "my-first-repo")
    • Description: Brief description of your project (optional)
    • Visibility: Choose Public or Private
    • Initialize: Check "Add a README file"
    • License: Choose a license if desired
  4. Click "Create repository"

Step 5: Clone Your Repository

To work with your repository locally, you'll need to clone it:

# Clone your repository
git clone https://github.com/yourusername/my-first-repo.git

# Navigate to the repository directory
cd my-first-repo

# List files to confirm successful clone
ls -la

Step 6: Basic Git Workflow

Now that you have a repository, learn the basic workflow:

  1. Make changes: Edit files in your repository
  2. Check status: git status
  3. Stage changes: git add filename or git add .
  4. Commit changes: git commit -m "Description of changes"
  5. Push to GitHub: git push

Step 7: Understanding GitHub Interface

Familiarize yourself with the GitHub web interface:

  • Code Tab: View your repository files and folders
  • Issues Tab: Track bugs, features, and tasks
  • Pull Requests Tab: Review and merge code changes
  • Actions Tab: Automate workflows and CI/CD
  • Projects Tab: Organize and track project progress
  • Settings Tab: Configure repository settings

Next Steps

Now that you have the basics down, consider exploring:

  1. Branching: Learn to create and work with branches
  2. Pull Requests: Practice the collaboration workflow
  3. Issues: Use GitHub's issue tracking system
  4. GitHub Actions: Automate your workflows
  5. Open Source: Contribute to open-source projects

Troubleshooting Common Issues

Problem: Authentication failures when pushing to GitHub

Solutions:

  • Use Personal Access Tokens instead of passwords
  • Set up SSH keys for password-free authentication
  • Use GitHub CLI for authentication: Run gh auth login in terminal and follow the prompts
  • Check if your credentials are correctly configured

GitHub CLI Authentication Steps:

# Install GitHub CLI (if not already installed)
# Download from: https://cli.github.com/

# Authenticate with GitHub
gh auth login

# Follow the prompts to:
# 1. Choose authentication method (browser or token)
# 2. Select preferred protocol (HTTPS or SSH)
# 3. Complete authentication in browser or enter token

# Verify authentication
gh auth status
Buy me a beer


Hi, how can I help you?

Buy me a coffee